home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 5
/
The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO
/
amiga
/
tdemo2.lha
/
ProgrammersInfo
/
UserStatus.mod.c
< prev
Wrap
C/C++ Source or Header
|
1994-06-05
|
10KB
|
281 lines
/* UserStatus.mod
.----------------------------------------.------------------------------------.
| Handle: | Slot Number: 1,222 |
| From: 123456789012345678901234567890 | Computer Type: |
| Phone: | Last Call: 06/06/93 @ 22:22:22 |
|-------------------------.--------------^----------.-------------------------|
| Security Level: 233 | Daily Time: 1,000 | Bulletins Access: Yes |
| Byte Ratio: | Time Left: 1,000 | Door Access: |
| File Ratio: Off | Time Bank: 1,000 | File Access: |
`-------------------------^-------------------------^-------------------------'
Totals Today's Stats Limits
.-------------------------.-------------------------.-------------------------.
| Calls: 11,000 | Calls: 11,000 | Calls: 11,000 |
| Messages: 11,000 | Messages: 11,000 | Messages: 22,099 |
|-------------------------|-------------------------|-------------------------|
| UL Files: 1,000 | UL Files: 1,000 | |
| UL Bytes: 1,000,000,000 | UL Bytes: 1,000,000,000 | |
|-------------------------|-------------------------|-------------------------|
| DL Files: 1,000 | DL Files: 1,000 | DL Files: 1,000 |
| DL Bytes: 1,000,000,000 | DL Bytes: 1,000,000,000 | DL Bytes: 1,000,000,000 |
`-------------------------^-------------------------^-------------------------'
*/
//**********************
//***** Includes *****
//**********************
#include <proto/all.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdarg.h>
#include <string.h>
#include <tempest/headers.h>
#include <Skeleton/Commas.h>
//********************************
//***** Structures/Defines *****
//********************************
struct MyMessage
{
struct Message Msg; // for Exec message routines
ULONG Command; // Command to be executed.
char *text1,
*text2,
*text3;
int Value1,
Value2;
ULONG LongValue;
LONGBITS Flags;
int carrier;
struct User *User;
struct SystemData *SystemData;
struct NodeData *NodeData;
struct Today *Today;
};
struct MyMessage send;
struct User *User;
struct MsgPort *MyPort = NULL;
struct MyMessage *msg;
int DoorStart(TEXT *);
int DOORIO(VOID);
VOID CloseStuff(VOID);
VOID pl(TEXT *,...);
VOID GetStr(TEXT *,int);
char MyName[60],st[60];
//******************
//***** Main *****
//******************
main(int argc,char *argv[])
{
char string[200],string1[200];
char Day[5],Month[5],Year[5];
register int x=1;
if(!DoorStart(argv[1])) { PutStr("UserStatus.mod v3.15\n"); exit(0); }
//********************************************************************
pl("\f
.----------------------------------------.------------------------------------.\r\n");
pl("|
Handle
:
%-30s
|
Slot Number
: %-5s
|\r\n",
User->Name,commas(User->Slot_Number,buff));
pl("|
From
: %-30s
|
Computer Type
: %11s
|\r\n",
User->City,User->ComputerType);
pl("|
Phone
: %-12s
|
Last Call
:
|\r\n",
User->VoicePhone);
pl("|-------------------------.--------------^----------.-------------------------|\r\n");
pl("|
Security Level
: %3d
|
Daily Time
: %-5s
|
Bulletins Access
:
|\r\n",
User->Security,commas((User->Limit_Time),buff));
pl("|
Byte Ratio
: %-2d
|
Time Left
: %-5s
|
Door Access
:
|\r\n",
User->F_Ratio,commas(User->Left_Time,buff));
pl("|
File Ratio
: %-2d
|
Time Bank
: %-5s
|
File Access
:
|\r\n",
User->B_Ratio,commas((User->Total_TimeBank),buff));
pl("`-------------------------^-------------------------^-------------------------'\r\n\r\n");
pl("
Totals Today's Stats Limits
\r\n");
pl(".-------------------------.-------------------------.-------------------------.\r\n");
pl("|
Calls
: %-6s
|
Calls
: ",
commas(User->Total_Calls,buff));
pl("%-6s
|
Calls
: ",
commas(User->Period_Calls,buff));
pl("%-6s
|\r\n",commas(User->Limit_Calls,buff));
pl("|
Messages
: %-6s
|
Messages
: ",
commas(User->Total_Posts,buff));
pl("%-6s
|
Messages
: ",
commas(User->Period_Posts,buff));
pl("%-6s
|\r\n",commas(User->Limit_Posts,buff));
pl("|-------------------------|-------------------------|-------------------------|\r\n");
pl("|
UL Files
: %-6s
|
UL Files
: ",
commas(User->Total_ULFiles,buff));
pl("%-6s
| |\r\n",commas(User->Period_ULFiles,buff));
pl("|
UL Bytes
: %-13s
|
UL Bytes
: ",
commas(User->Total_ULBytes,buff));
pl("%-13s
| |\r\n",commas(User->Period_ULBytes,buff));
pl("|-------------------------|-------------------------|-------------------------|\r\n");
pl("|
DL Files
: %-6s
|
DL Files
: ",
commas(User->Total_DLFiles,buff));
pl("%-5s
|
DL Files
: ",
commas(User->Period_DLFiles,buff));
pl("%-5s
|\r\n",commas(User->Limit_DLFiles,buff));
pl("|
DL Bytes
: %-13s
|
DL Bytes
: ",
commas(User->Total_DLBytes,buff));
pl("%-13s
|
DL Bytes
: ",
commas(User->Period_DLBytes,buff));
pl("%-13s
|\r\n",commas(User->Limit_DLBytes,buff));
pl("`-------------------------^-------------------------^-------------------------'\r\n");
// strcpy(string,ctime(&User->Time_Last_Logoff));
// strmid(string,Month,5,3);
// strmid(string,Day,9,2);
// strmid(string,Year,23,2);
// pl("
Lst Date On :
%2s %s %s\r\n",Day,Month,Year);
//********************************************************************
// pl("
Security Lv :
%d\r\n",User->Security);
//********************************************************************
// pl("
# Times On :
%-5d
Today :
%d\r\n",User->Total_Calls,User->Period_Calls);
//********************************************************************
// pl("
Msgs Posted :
%-5d
Today :
%d\r\n",User->Total_Posts,User->Period_Posts);
//********************************************************************
// if(User->F_Ratio==0) strcpy(string1,"Disabled");
// else sprintf(string1,"%d/1",User->B_Ratio);
// pl("
File Ratio :
%s\r\n",string1);
//********************************************************************
// if(User->B_Ratio==0) strcpy(string1,"Disabled");
// else sprintf(string1,"%d/1",User->B_Ratio);
// pl("
Byte Ratio :
%s\r\n",string1);
//********************************************************************
// pl("
# Downloads :
%-4d
Today :
%d\r\n",User->Total_DLFiles,User->Period_DLFiles);
//********************************************************************
// pl("
# Uploads :
%-4d
Today :
%d\r\n",User->Total_ULFiles,User->Period_ULFiles);
//********************************************************************
// pl("
Bytes DL'd :
%-10ld
Today :
%ld \r\n",User->Total_DLBytes,User->Period_DLBytes);
//********************************************************************
// pl("
Bytes UL'd :
%-10ld
Today :
%ld\r\n",User->Total_ULBytes,User->Period_ULBytes);
//********************************************************************
// GetStr(string1,19);
// pl("
Online Baud :
%s\r\n",string1);
//********************************************************************
// pl("
Bytes Avail :
%ld\r\n\r\n",User->Limit_DLBytes);
//********************************************************************
//*************************
//***** Close Stuff *****
//*************************
CloseStuff();
}
//************************
//***** Door Start ***** // MUST BE INCLUDED IN ALL DOORS!
//************************
int DoorStart(TEXT *node)
{
struct MsgPort *HisPort;
send.carrier=0;
sprintf(st,"%s:TEMPEST_DOOR",node);
HisPort = FindPort(st);
if(HisPort==NULL) return (FALSE);
sprintf(MyName,"%s:DOOR_PORT",node);
MyPort = CreatePort(MyName,0L);
if(MyPort==NULL)
{
PutStr("Cant open port");
return(int)FALSE;
}
DOORIO();
User=*&send.User;
return (int)TRUE;
}
//********************
//***** DoorIO ***** // MUST BE INCLUDED IN ALL DOORS!
//********************
int DOORIO(VOID)
{
struct MsgPort *HisPort;
if(send.carrier) return(0);
HisPort = FindPort(st);
if(HisPort!=NULL)
{
send.Msg.mn_Node.ln_Type = NT_MESSAGE;
send.Msg.mn_Length = sizeof(send);
send.Msg.mn_ReplyPort = MyPort;
send.carrier=0;
PutMsg((struct MsgPort *)HisPort,(struct Message *)&send);
Wait(1 << MyPort->mp_SigBit);
GetMsg(MyPort);
if(send.carrier) CloseStuff();
return(1);
}
return(0);
}
//*************************
//***** Close Stuff ***** // MUST BE INCLUDED IN ALL DOORS!
//*************************
VOID CloseStuff(VOID)
{
send.Command=999;
DOORIO();
while(msg=(struct MyMessage *)GetMsg(MyPort)) ReplyMsg((struct Message *)msg);
if(MyPort) DeletePort(MyPort);
exit(0);
}
//*********************************
//***** GetStr (Get String) ***** // Command 33
//*********************************
VOID GetStr(TEXT *s,int opt)
{
send.Command=33;
send.Value1=opt;
strcpy(s,NULL);
send.text1=s;
DOORIO();
}
//*****************************
//***** PL (Print Line) ***** // Command 1 with a twist
//*****************************
VOID pl(TEXT *fmt,...)
{
va_list args;
char s[255];
va_start(args,fmt);
vsprintf(s,fmt,args);
va_end(args);
send.Command=1;
send.text1=&s[0];
DOORIO();
}